<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img  class="banner-img" :src="bannerImg">
      <div class="banner-info">
        <div class="banner-title">{{this.sightName}}</div>
        <div class="banner-number">
        <span>
              <img class="header-ico-search banner-ico" src="@/assets/style/ico/img.svg">
        </span>
          {{this.gallaryImgs.length}}
        </div>
      </div>
    </div>

    <FadeAnimation>
      <!--@close 是从里面点击关闭按钮的时候触发上来的事件-->
      <CommonGallary :imgs="gallaryImgs" v-show="showGallary" @close="handleGallaryClose"></CommonGallary>
    </FadeAnimation>

  </div>
</template>

<script>

  import CommonGallary from 'common/gallary/Gallary'
  import FadeAnimation from 'common/fade/FadeAnimation.vue'

  export default {
    name: 'DetailBanner',
    props: {
      sightName: String,
      bannerImg: String,
      gallaryImgs: Array,
    },
    components: {
      CommonGallary,
      FadeAnimation,
    },
    data() {
      return {
        showGallary: false,
      }
    },
    methods: {
      handleBannerClick() {
        this.showGallary = true
      },
      handleGallaryClose() {
        this.showGallary = false
      }
    }
  }
</script>

<style scoped lang="stylus">

  /*样式里面引入样式，要加一个@符号*/
  @import "~styles/varibles.styl"


  .banner
    position: relative
    overflow: hidden
    height: 0
    padding-bottom: 55%
    .banner-img
      width: 100%
    .banner-info
      position: absolute
      display: flex
      left: 0
      color: #fff
      right: 0
      bottom: 0
      line-height: .6rem
      //渐变色
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner-title
        flex: 1
        font-size: .32rem
        padding: 0 .2rem
      .banner-number
        padding: 0 .4rem
        height: .32rem
        line-height: .32rem
        border-radius: .2rem
        background: rgba(0, 0, 0, .8)
        font-size: .24rem
        margin-top: .14rem
        .header-ico-search
          width :.20rem;
          height : .20rem;
        .banner-ico
          font-size: .18rem
</style>
